
import 'package:flutter/material.dart';

class LoadingContainer extends StatelessWidget {

  final Widget child;
  final bool isLoading;
  final bool cover;

  const LoadingContainer({Key key, @required this.isLoading, this.cover = false, @required this.child}) : super(key: key);


  Widget _loadingView() {
    return Center(
      child: CircularProgressIndicator(),
    );
  }
  @override
  Widget build(BuildContext context) {
    return !cover?!isLoading? child : _loadingView() : Stack(
      children: <Widget>[
        child,
        isLoading ? _loadingView() : Container()
      ],
    );
  }
}